package faw.car.ccentersdk.prop;

/**
 * @Author zhuima
 */
public class HQCarAccessControlConfig implements android.os.Parcelable {

    /**
     * 是否开启防暴点逻辑
     */
    private boolean isSupportViolenceClickControl = true;

    /**
     * 是否开启即时返回逻辑
     * <p>
     * {@link #isSupportViolenceClickControl} 为 false 时失效
     */
    private boolean isSupportAutoCallback = true;

    /**
     * 是否支持超时状态回调
     * <p>
     * {@link #isSupportViolenceClickControl} 为 false 时失效
     */
    private boolean isSupportTimeoutCallback = true;

    /**
     * 持续下行间隔时间
     * {@link #isSupportViolenceClickControl} 为 false 时失效
     */
    private long invokeInterval = 1_000L;

    /**
     * 调用超时状态回调间隔
     * {@link #isSupportViolenceClickControl} 为 false 时失效
     */
    private long timeoutCallbackInterval = 2_000L;

    public HQCarAccessControlConfig(boolean isSupportViolenceClickControl,
                                    boolean isSupportAutoCallback,
                                    boolean isSupportTimeoutCallback,
                                    long invokeInterval,
                                    long timeoutCallbackInterval) {
        this.isSupportViolenceClickControl = isSupportViolenceClickControl;
        this.isSupportAutoCallback = isSupportAutoCallback;
        this.isSupportTimeoutCallback = isSupportTimeoutCallback;
        this.invokeInterval = invokeInterval;
        this.timeoutCallbackInterval = timeoutCallbackInterval;
    }

    public boolean isSupportViolenceClickControl() {
        return isSupportViolenceClickControl;
    }

    public void setSupportViolenceClickControl(boolean supportViolenceClickControl) {
        isSupportViolenceClickControl = supportViolenceClickControl;
    }

    public boolean isSupportAutoCallback() {
        return isSupportAutoCallback;
    }

    public void setSupportAutoCallback(boolean supportAutoCallback) {
        isSupportAutoCallback = supportAutoCallback;
    }

    public boolean isSupportTimeoutCallback() {
        return isSupportTimeoutCallback;
    }

    public void setSupportTimeoutCallback(boolean supportTimeoutCallback) {
        isSupportTimeoutCallback = supportTimeoutCallback;
    }

    public long getInvokeInterval() {
        return invokeInterval;
    }

    public void setInvokeInterval(long invokeInterval) {
        this.invokeInterval = invokeInterval;
    }

    public long getTimeoutCallbackInterval() {
        return timeoutCallbackInterval;
    }

    public void setTimeoutCallbackInterval(long timeoutCallbackInterval) {
        this.timeoutCallbackInterval = timeoutCallbackInterval;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(android.os.Parcel dest, int flags) {
        dest.writeByte(this.isSupportViolenceClickControl ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isSupportAutoCallback ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isSupportTimeoutCallback ? (byte) 1 : (byte) 0);
        dest.writeLong(this.invokeInterval);
        dest.writeLong(this.timeoutCallbackInterval);
    }

    public void readFromParcel(android.os.Parcel source) {
        this.isSupportViolenceClickControl = source.readByte() != 0;
        this.isSupportAutoCallback = source.readByte() != 0;
        this.isSupportTimeoutCallback = source.readByte() != 0;
        this.invokeInterval = source.readLong();
        this.timeoutCallbackInterval = source.readLong();
    }

    public HQCarAccessControlConfig() {
    }

    protected HQCarAccessControlConfig(android.os.Parcel in) {
        this.isSupportViolenceClickControl = in.readByte() != 0;
        this.isSupportAutoCallback = in.readByte() != 0;
        this.isSupportTimeoutCallback = in.readByte() != 0;
        this.invokeInterval = in.readLong();
        this.timeoutCallbackInterval = in.readLong();
    }

    public static final Creator<HQCarAccessControlConfig> CREATOR = new Creator<HQCarAccessControlConfig>() {
        @Override
        public HQCarAccessControlConfig createFromParcel(android.os.Parcel source) {
            return new HQCarAccessControlConfig(source);
        }

        @Override
        public HQCarAccessControlConfig[] newArray(int size) {
            return new HQCarAccessControlConfig[size];
        }
    };
}
